﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CommonTypeSystem
{
    class Student:ICloneable, IComparable<Student>
    {
        public enum Faculties
        {
            FKS,
            FETT,
            DGD
        }
        public enum Universities { NBU, TE, SU }
        public enum Specialties { lektroniks, komputer }

        private string names;
        private int ssn;
        private string email;
        private string permanentAddress;
        private string mobilePhone;
        private int course;
        private Faculties faculty;
        private Universities university;
        private Specialties specialty;

        public string Names
        {
            get
            {
                return names;
            }
            set
            {
                names = value;
            }
        }

        public int SSN
        {
            get
            {
                return ssn;
            }
            set
            {
                ssn = value;
            }
        }

        public string Email
        {
            get
            {
                return email;
            }
            set
            {
                email = value;
            }
        }

        public string PermanentAddress
        {
            get
            {
                return permanentAddress;
            }
            set
            {
                permanentAddress = value;
            }
        }

        public string MobilePhone
        {
            get
            {
                return mobilePhone;
            }
            set
            {
                mobilePhone = value;
            }
        }

        public int Course
        {
            get
            {
                return course;
            }
            set
            {
                course = value;
            }
        }

        public Faculties Faculty
        {
            get
            {
                return faculty;
            }
            set
            {
                faculty = value;
            }
        }

        public Universities University
        {
            get
            {
                return university;
            }
            set
            {
                university = value;
            }
        }

        public Specialties Specialty
        {
            get
            {
                return specialty;
            }
            set
            {
                specialty = value;
            }
        }

        public Student(string names, int sSN, string email, string permanentAddress, string mobilePhone, int course, Faculties faculty, Universities university, Specialties specialty)
        {
            this.names = names;
            SSN = sSN;
            this.email = email;
            this.permanentAddress = permanentAddress;
            this.mobilePhone = mobilePhone;
            this.course = course;
            this.faculty = faculty;
            this.university = university;
            this.specialty = specialty;
        }

        public override bool Equals(object obj)
        {
            Student student = obj as Student;
            if (student == null) 
            {
                return false;
            }
            if (!(this.Names.Equals(student.Names)))
            {
                return false;
            }
            if (!(this.SSN.Equals(student.SSN)))
            {
                return false;
            }

            return true;
        }

        public override string ToString()
        {
            return string.Format("student: {0}\nSSN: {1}\nphone: {2}",this.Names,this.SSN, this.MobilePhone);
        }

        public override int GetHashCode()
        {
            int hashCode = this.Names.GetHashCode() ^ this.SSN;
            return hashCode;
        }

        public static bool operator ==(Student first, Student second) 
        {
            return (Student.Equals(first, second)); first.Equals(second);
        }

        public static bool operator !=(Student first, Student second) 
        {
            return !(Student.Equals(first, second));
        }

        public object Clone()
        {
            Student newStudent = new Student(this.names, this.ssn, this.email,
                this.permanentAddress, this.mobilePhone, this.course, this.faculty,
                this.university, this.specialty);
            return newStudent;
        }

        public int CompareTo(Student other)
        {
            if (this.Names != other.Names) 
            {
                return this.Names.CompareTo(other.Names);
            }
            if (this.SSN != other.SSN) 
            {
                return this.SSN.CompareTo(other.SSN);
            }
            return 0;
        }
    }
}
